package com.yfp.org.mq;

import com.yfp.common.core.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum OrderStatus {
    // 待支付
    ToBePaid(1,"ToBePaid"),
    // 已取消
    Canceled(7,"Canceled"),
    // 已退款
    Refund(4,"Canceled"),
    // 待取餐
    AwaitPackage(8,"AwaitPackage"),
    // 已完成
    Finish(3,"Finish");

    int code;
    String orderStatus;
    public static OrderStatus getOrderStatus(String  orderStatus)
    {
        for (OrderStatus orderStatus1 : OrderStatus.values()) {
            if (orderStatus1.getOrderStatus().equals(orderStatus)) {
                return orderStatus1;
            }
        }
        throw new ServiceException("未找到对应订单状态");
    }
}
